﻿Public Class ReportCriteriaDates
    Public report2Render As dbiWSF.UserInterface.dbiWSFReporting.reportProjectedInboundShipments
    Public reportObject As dbiWSF.ControlLibrary.dbiWSFReport

    Public Sub New(ByRef report2Manage As dbiWSF.UserInterface.dbiWSFReporting.dbiWSFReportObject, ByRef reportObject2Use As dbiWSF.ControlLibrary.dbiWSFReport)

        InitializeComponent()

        'Store the constructor objects in variables available to the application.
        report2Render = report2Manage
        reportObject = reportObject2Use

        'Preset the start and end date drop date controls to the values set to initialize the report in the dbiExplorerBar click event.
        Me.DbiDropDateReportStart.Date = report2Manage.reportStart
        Me.DbiDropDateReportEnd.Date = report2Manage.reportEnd

    End Sub

    Private Sub ButtonPrintReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonPrintReport.Click

        'Send the report to a printer.
        'NOTE: This will invoke a standard printer select dialog before beginning the print job.
        reportObject.DbiList1.Print()

    End Sub

    Private Sub ButtonPreviewReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonPreviewReport.Click

        'Send the report to the Print Preview using the default printer for layout.
        Dim printSettings As New Printing.PrinterSettings

        reportObject.DbiList1.PrintPreview()

    End Sub

    Private Sub DbiDropDateReport_DateChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DbiDropDateReportStart.DateChanged, DbiDropDateReportEnd.DateChanged

        If Me.DbiDropDateReportEnd.Date < Me.DbiDropDateReportStart.Date Then

            Me.DbiDropDateReportEnd.Date = Me.DbiDropDateReportStart.Date

        End If

    End Sub

End Class
